﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PlaceOrder_Core.PlaceOrderModels;
[Table("chat_message")]
public partial class ChatMessage
{
    public override string ToString()
    {
        // Use string interpolation to format the output
        return $"Id: {Id}, " +
               $"聊天人: {ChatId}, " +
               $"信息: {ChatMessageInfo}, " +
               $"中介: {BrokerId}, " +
               $"方向: {Direction}。 ";
    }
    /// <summary>
    /// 主键（每条消息）
    /// </summary>
    [Column("id")]
    [Key]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 聊天人ID
    /// </summary>
    [Column("chat_id")]
    public int? ChatId { get; set; }

    /// <summary>
    /// 消息保存（目前只支持文本）
    /// </summary>
    [Column("chat_message")]
    public string? ChatMessageInfo { get; set; }

    /// <summary>
    /// 中介ID
    /// </summary>
    /// 
    [Column("broker_id")]
    public int? BrokerId { get; set; }

    /// <summary>
    /// 方向
    /// </summary>
    /// 
    [Column("direction")]
    public short? Direction { get; set; }

    /// <summary>
    /// 消息即时时间
    /// </summary>
    /// 
    [Column("create_time")]
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 关联的一笔交易ID
    /// </summary>
    /// 
    [Column("trade_id")]
    public long? TradeId { get; set; }

    /// <summary>
    /// 聊天内容是否和交易相关
    /// </summary>
    /// 
    [Column("is_trade")]
    public bool? IsTrade { get; set; }

    [Column("update_time")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 引用消息
    /// </summary>
    /// 
    [Column("quote_message")]
    public string? QuoteMessage { get; set; }

    [Column("channel_id")]
    public string? ChannelId { get; set; }

    /// <summary>
    /// 其实就是中介名
    /// </summary>
    [NotMapped]
    public string BrokerName { get; set; }

    /// <summary>
    /// 是否是引用消息
    /// </summary>
    [NotMapped]
    public bool? IsQuote { get; set; }
}
